package com.baidu.ota.impl;

import android.os.Build;

public class RecoveryFactory {
    private static volatile RecoverySystem inst;

    private RecoveryFactory() {
    }

    public static RecoverySystem getInst() {
        if (inst == null) {
            synchronized (RecoveryFactory.class) {
                if (inst == null) {
                    inst = createByVersion();
                }
            }
        }
        return inst;
    }

    private static RecoverySystem createByVersion() {
        RecoverySystem inst;
        if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M) {
            inst = new RecoverySystemGT23();
        } else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
            inst = new RecoverySystemLT23();
        } else {
            inst = new RecoverySystemEQ23();
        }
        return inst;
    }
}
